package com.saxon.blog.swagger;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.ArrayList;

@Configuration
@EnableSwagger2
public class MySwagger {
    @Bean
    public Docket docket () {
        return new Docket (DocumentationType.SWAGGER_2)
                .select ().apis (RequestHandlerSelectors.basePackage ("com.saxon.blog.controller"))//选择扫描的包
                .build ().
                        groupName ("saxon")//设置这个组的名字
                .apiInfo (
                        new ApiInfo (
                                "saxon Documentation",//文档标题
                                "Api Documentation",//文档描述
                                "1.0",//版本号
                                "urn:tos",//连接
                                new Contact (//作者信息
                                        "莫松",
                                        "2433027822@qq.com",
                                        "2433027822@qq.com"),
                                "Apache 2.0",
                                "http://www.apache.org/licenses/LICENSE-2.0",
                                new ArrayList ()));
    }
}
